Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
codec_map.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Roc authors
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9//! @file roc_fec/codec_map.h
10//! @brief FEC codec map.
11
12#ifndef ROC_FEC_CODEC_MAP_H_
13#define ROC_FEC_CODEC_MAP_H_
14
16#include "roc_core/iallocator.h"
21
22namespace roc {
23namespace fec {
24
25//! FEC codec map.
26class CodecMap : public core::NonCopyable<> {
27public:
28 //! Initialize.
30
31 //! Create a new block encoder.
32 //!
33 //! @remarks
34 //! The codec type is determined by @p config.
35 //!
36 //! @returns
37 //! NULL if parameters are invalid or given codec support is not enabled.
40 core::IAllocator& allocator) const;
41
42 //! Create a new block decoder.
43 //!
44 //! @remarks
45 //! The codec type is determined by @p config.
46 //!
47 //! @returns
48 //! NULL if parameters are invalid or given codec support is not enabled.
51 core::IAllocator& allocator) const;
52
53private:
54 enum { MaxCodecs = 2 };
55
56 struct Codec {
57 packet::FECScheme scheme;
58
59 IBlockEncoder* (*encoder_ctor)(const CodecConfig& config,
61 core::IAllocator& allocator);
62
63 IBlockDecoder* (*decoder_ctor)(const CodecConfig& config,
65 core::IAllocator& allocator);
66 };
67
68 void add_codec_(const Codec& codec);
69 const Codec* find_codec_(packet::FECScheme scheme) const;
70
71 size_t n_codecs_;
72 Codec codecs_[MaxCodecs];
73};
74
75} // namespace fec
76} // namespace roc
77
78#endif // ROC_FEC_CODEC_MAP_H_
Buffer pool.
Memory allocator interface.
Definition: iallocator.h:23
Base class for non-copyable objects.
Definition: noncopyable.h:23
FEC codec map.
Definition: codec_map.h:26
IBlockDecoder * new_decoder(const CodecConfig &config, core::BufferPool< uint8_t > &pool, core::IAllocator &allocator) const
Create a new block decoder.
CodecMap()
Initialize.
IBlockEncoder * new_encoder(const CodecConfig &config, core::BufferPool< uint8_t > &pool, core::IAllocator &allocator) const
Create a new block encoder.
FEC block decoder interface.
FEC block encoder interface.
FEC codec parameters.
Memory allocator interface.
FEC block decoder interface.
FEC block encoder interface.
FECScheme
FECFRAME scheme.
Definition: fec.h:23
Root namespace.
Non-copyable object.
FEC codec parameters.
Definition: codec_config.h:22